
#import "HelpViewController.h"
#import "NSString+VoiceOver.h"

@interface HelpViewController ()

@property (weak, nonatomic) IBOutlet UIWebView *webView;

@end

@implementation HelpViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.extendedLayoutIncludesOpaqueBars = YES;
    self.edgesForExtendedLayout = UIRectEdgeNone;

    self.view.backgroundColor = [UIColor whiteColor];
    
    NSString *locale = @"sv";
    NSString *file = [locale stringByAppendingFormat:@"_%@", self.documentFile];
    NSString *html = [NSString stringWithContentsOfFile:[[NSBundle mainBundle]
                                                         pathForResource:file
                                                         ofType:@"html"]
                                               encoding:NSUTF8StringEncoding error:nil];
    html = [html stringByReplacingOccurrencesOfString:@"../" withString:@""];
    if (voiceoverEnabled) {
        html = [html stringByOptimizingForVoiceOver];
    }
    self.webView.dataDetectorTypes = UIDataDetectorTypeNone;
    [self.webView loadHTMLString:html baseURL:[NSBundle mainBundle].bundleURL];
}

@end
